<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='商品'}}
{{assign var="app" value='Goods'}}
{{assign var="table" value='datas'}}
{{assign var="act" value='modify'}}
<title>{{$title}} - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
{{include file="{{$smarty.const.PLUG}}chosen/chosen.html"}}
{{include file="{{$smarty.const.PLUG}}drag/drag.html"}}
{{include file="{{$smarty.const.PLUG}}verify/verify.html"}}
</head>

<body>

	{{include file="include/sidebar.html"}}

	<div class="body_right">
	<div id="content">
	<div class="search">
		<ul class="bread">
			<li>◆ {{$title}}管理 －> {{$result.title|default:'添加'}}</li>
		</ul>
	</div>
			
		<!--内容 S-->
		<form name="form" class="verify" method="post">
		<input type="hidden" name="id" value="{{$result.id}}"/>
		<input type="hidden" name="item" value="{{$item}}"/>
		<table class="table table-bordered tablest modify">
		  <tbody>
			<tr>
				<td>标题：</td>
				<td>
					<input class="input-xlarge" type="text" name="title" maxlength="50" value="{{$result.title}}"> <span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>展示图：</td>
				<td>
					{{form type="img" data=$result.image name='image' item=$item}}<span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>商品类别：</td>
				<td>
					<select name="goods_type" class="chosen" style="min-width:150px">
						<option value=''>请选择类别..</option>
						{{if $goods_type}}
						{{foreach from=$goods_type item=val key=key}}
						<option {{if $val.id == $result.goods_type}} selected="selected" {{/if}} value="{{$val.id}}">{{$val.title}}</option>
						{{/foreach}}
						{{/if}}
					</select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>价格：</td>
				<td>
					<input class="input-xlarge" type="text" name="price" style="max-width:80px" maxlength="50" value="{{$result.price}}"> 元<span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>库存：</td>
				<td>
					<input class="input-xlarge" type="text" name="number" style="max-width:80px" maxlength="50" value="{{$result.number}}"> 件<span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>商品展示轮播图：</td>
				<td>
					{{form type="img_array" data=$result.params.image name='params[image]' item=$item}}
				</td>
			</tr>
			<tr>
				<td>推荐：</td>
				<td>
			  		{{html_radios name=hot options=array('否','是') checked=$result.hot|default:0}}
				</td>
			</tr>
			<tr>
				<td>是否一元购：</td>
				<td>
			  		{{html_radios name=one_shop options=array('否','是') checked=$result.one_shop|default:0}}
				</td>
			</tr>
			<tr class="one {{if $result.one_shop != '1'}}disabled{{/if}}" >
				<td>揭晓时间：</td>
				<td>
					<input class="input-xlarge Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" type="text" name="rate" value="{{$result.rate|date_format:"Y-m-d H:i:s"}}">
				</td>
			</tr>
			<tr class="one {{if $result.one_shop != '1'}}disabled{{/if}}">
				<td>参与人数：</td>
				<td>
					<input class="input-xlarge" type="text" name="params[o_member]" style="max-width:80px" maxlength="50" value="{{$result.params.o_member}}">人
				</td>
			</tr>
			<tr>
				<td>商品简述：</td>
				<td>
					<textarea name="params[resume]" style="width:400px; height:100px;">{{$result.params.resume}}</textarea>
					<span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td>图文详情：</td>
				<td>
					<textarea id='editor1' class="editor" name='content'>{{$result.content|encodeHtml}}</textarea>
					{{form type='img' kind="ueditor" class='editor1' item=$item}}
				</td>
			</tr>
			<!-- <tr class="ttitle">
				<td colspan="2"> >> SEO</td>
			</tr>
			<tr>
				<td>SEO标题：</td>
				<td>
					<input type="text" name="params[seo_title]" maxlength="30" value="{{$result.params.seo_title}}"> <span class="red">*</span>
				</td>
			</tr> -->
<!-- 			<tr>
				<td>SEO关键字：</td>
				<td>
					<input type="text" maxlength="70" name="params[seo_keywords]" value="{{$result.params.seo_keywords}}"/> <span class="red">*</span> 
					<span class="notice red">多个关键字用英文逗号分隔</span>
				</td>
			</tr>
			<tr>
				<td>SEO描述：</td>
				<td>
					<textarea name="params[seo_description]" maxlength="80" style="width:400px;height:50px;">{{$result.params.seo_description}}</textarea>
					<span class="red">*</span>
				</td>
			</tr>
			 -->
		  </tbody>
		</table>
		<div class="bottom_button">
			<div class="submit btn btn-info"><i class="icon-ok icon-white"></i>确认</div>
		</div>
		</form>
		<!--内容 E-->
</div>
</div>
<script type="text/javascript">

	$(document).ready(function(){
		if($(".one").hasClass("disabled"))
			$(".one").hide();
		else
			$(".one").show();
	}); 

	$("input[name='one_shop']").change(function(){
		var val = $("input[name='one_shop']:checked").val();
		if(val == '0')
			$(".one").hide();
		else if(val == '1')
			$(".one").show();
	})
	
	// 提交表单
	$(".submit").click(function(){
		var params = $("form").serialize();
		$.post('{{"index.php?app={{$app}}&act=save"|URL}}',params,function(result){
			if(result.statusCode == '300'){
				ui.error(result.message);
			}else if(result.statusCode=='201'){//添加成功后
				ui.success(result.message);
				window.parent.document.location.reload();
			}else if(result.statusCode=='200'){//编辑成功后
				ui.success(result.message);
            	window.parent.document.location.reload();
			}
		},'json');	
	});
</script>
{{include file="{{$smarty.const.PLUG}}ueditor/ueditor.html"}}
</body>
</html>